<?php

$xml = new SimpleXMLElement('<foo/>');
$xml->addChild('child1', '<somescript/>');
$xml->addChild('child2', htmlspecialchars('<aanotherscript/>'));
$xml->addChild('child3', htmlspecialchars(htmlspecialchars('<thridscript/>')));

var_dump($xml->asXML());

var_dump('<somescript/>');
var_dump(htmlspecialchars('<aanotherscript/>'));
var_dump(htmlspecialchars(htmlspecialchars('<aanotherscript/>')));

class PregTest {
	private $name;
	
	public function __construct($name) {
		$this->name = $name;
	}
	
	public function test($string) {
		var_dump($string);
		return $this->name;
	}
}

$obj = new PregTest('blbla');
var_dump(preg_replace_callback('/([a-zA-Z]*):([\/a-zA-Z0-9]*)/', array($obj, 'test'), 'Hello world (media:/foo/bar) '));

?>